﻿using UnityEngine;

public class UIScaler : MonoBehaviour
{
    public float scaleFactor = 1.5f; // 放大的因子  
    public float speed = 2.0f;        // 放大缩小的速度  
    private Vector3 originalScale;    // 原始缩放值  

    void Start()
    {
        originalScale = transform.localScale; // 记录原始缩放值  
    }

    void Update()
    {
        // 计算当前的缩放比例  
        float scale = Mathf.PingPong(Time.time * speed, 1) * (scaleFactor - 1) + 1;

        // 应用新的缩放值  
        transform.localScale = originalScale * scale;
    }
}